home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Text Processing
/
PlainText129a Folder
/
PlainText Worksheet
< prev
Wrap
Text File
|
1994-05-12
|
18KB
|
370 lines
;----------------------------------------------------------------------------
; Worksheet
;
; Use this window as a scratch pad for keeping notes and as a space for
; temporary and intermediate work. Its contents are saved between launches
; of the PlainText program. If you don’t like the idea of having a work-
; that is always open, select the “No Worksheet” option in the Edit Menu.
;
; Mel Park, Memphis, Tennessee
;----------------------------------------------------------------------------
This is still an early version of PlainText. The first non-beta version
was version 1.2.1. This is version 1.2.9a. All major features work, and seem
to work well, on the machines that I and others have tested it on.
You should make a copy of this file and save it somewhere with a different
name. One way of doing this is to select the “Save a Copy” item from the
File Menu. Name the copy “Original PlainText Worksheet” or some such.
File Menu
This is standard Mac stuff. PlainText will open any text file. Printing is
pretty ordinary. There is no way to change print margins or lines per page.
A short vertical line appears at the top of every text window which
indicates the recommended right margin. Text wrapped to this width will be
centered on the printed page. PlainText prints the page number at the
bottom of every page.
If you hold the option key down while selecting the Open menu item, then
all files, not just text files, are displayed and can be opened. Files
opened in this way are read only. You can copy data from them to the
clipboard but not change them in any way.
The “Save” menu item is only activated when a file has been changed by
adding or removing characters. The term “dirty” is commonly used to
describe text files in this state. Non-editing changes, such as changing
the font or adding a mark do not dirty a file. However, all such changes,
even scroll position and selection range, are always saved to disk when you
close a file. So, don’t be surprised by disk activity when you close a file
in which you have made no changes.
Edit Menu
Shift Right and Shift Left add or remove one tab on each line or, when
word wrap is on, each paragraph within the selection region. At the same
time, it converts all space runs to the corresponding number of tabs.
“Align” aligns all subsequent lines to the first line in the selection
region.
The Undo function provides the one level of undo that you expect with a
Macintosh application. “No Worksheet” will close the worksheet window and
set PlainText to not open a worksheet window in the future. It is reversed
by the “Use Worksheet” menu item which becomes an option when there is no
worksheet. The Format dialog of the Edit Menu is where you select fonts and
font size, turn wordwrapping on or off (on is the default), select tab
width, and show or not show invisible characters. These settings are
remembered for each document and retained between launches. (Naturally,
this is a Mac.)
The “Format…” menu item calls a dialog for changing text font, text size,
and certain preferences. The “Show Invisibles” check box prints ‘¿’ for all
non-printing characters, ‘Δ’ for tabs, ‘¬’ for carriage returns, and ‘◊’
for spaces. Automatic word wrap can be turned off or on and made to occur
when text exceeds the width of the text’s window or a particular number of
characters (Line Length). This line length parameter is also used for the
“Hard Wrap to Length” item in the Convert Menu. The “Auto Indent” feature
will look at the preceeding line, when word wrap is off, or paragraph, when
word wrap is on, and indent each new line to align with it. Clicking the
okay button (or typing the return or enter key) applies those settings to
the front window. Clicking the cancel button (or typing escape or
command-period) cancels the dialog and does not make any changes to the
front window. Clicking on the “All Files” button applies the settings to
the front window and saves them as default settings that will be applied to
all new windows and any foreign file that has not been previously opened by
PlainText, MPW, or Alpha.
Find Menu
This all works. “Find…” and “Replace…” are pretty standard and pretty
intuitive functions for text windows. The search string can be a selection
expression, that is, an expression that contains wildcards. Try a search
using *menu as the selection expression. Choose “Find…” and type “*menu”
(with or without quotes) and click the “Selection Expression” radio button.
Now click the Find button (or hit the return key). See how a line
containing “menu” has been found? Command-G repeats the search.
If the selection expression is a number, it is interpreted as a line
number. Try 83 as a selection expression.
This line, the 83rd in this window, will be selected.
If you hold down the shift key when you choose any of the Find menu items,
then the search will be in the reverse direction. This is handiest when
used in conjunction with the keyboard equivalents command-h and command-g.
Mark Menu
Marks are like bookmarks that you can place in a text file so that you can
recall previous selections. When you select a mark from the Mark Menu, the
text corresponding to that mark is selected and the window scrolls to show
it. You can add new marks with the Mark menu item and remove them with
Unmark. You can alphabetize the order in which marks are displayed in the
Mark Menu by selecting the Alphabetize menu item. Selecting it again
restores the original order. Look at the Marks that I have made for this
file by opening the Marks Menu.
Window Menu
Stack and Tile windows work, as does the rest, a catalog of open windows.
The menu item for the front window is checked. The target window is
indicated by the bullet symbol (•). Windows whose changes have not yet been
saved to disk are underlined.
Convert Menu
These functions all work. If you spot bugs in them, be sure to let me
know. This set of functions, by the way, was selected from those I find
myself using many times a day in Vantage, the desk accessory editor I have
used for years. The big, full-featured editors, like Pete Keleher’s Alpha
and BBEdit, by Rich Siegel, have these features, plus many more, as well.
Strip Linefeeds is the way to convert an MS/DOS text file to the Mac
convention. Strip Controls removes all characters with an Ascii code of 31
or less, except carriage returns and tabs. Form Paragraphs and Straight to
Curly Quotes gets it ready for pasting into a word processor. Hard Wrap to
Window and Curly to Straight quotes reverses those steps, as when you want
to prepare text for e-mail. Both Hard Wrap functions insert hard carriage
returns at line ends, where a line end is either defined by the size of the
window (Hard Wrap to Window) of the line length parameter set in the Format
Dialog (Hard Wrap to Length).
Besides being fast and able to handle even very large files, PlainText has
these built-in features:
1. Double-clicking selects a whole word. Note that double-clicking
the space after a word selects the preceeding word and the space.
This is a bug that is close enough to being a feature that I am
not fixing it.
2. Triple-clicking selects a whole line.
3. Double clicking on or just before a bracket or parenthesis (i.e.
“[”, “{”, etc.) causes all the text between the bracket or
parenthesis and its matching bracket or parenthesis to become
selected.
4. Cutting, pasting, and undoing are fully implemented.
5. The arrow keys work to move the insertion point or selection (hold
the shift key down) in the expected ways.
6. Command-option-uparrow moves the insertion point to the top of the
file. Command-option-downarrow does the opposite. Holding the shift
key down while doing either of these extends the selection to either
the top or bottom of the document.
7. Command-right arrow moves the insertion point to the end of the
current line. Option-right arrow moves the cursor by words. The left
arrow combinations work in the same way, of course, and holding the
shift key down with any of these combinations extends the selection.
This is the standard Macintosh use of the arrow keys.
8. It is a command-line interpreter in its own right. Simply type a
command that PlainText understands and then hit the enter (not
return) key. This will work in any text window.
The following commands can be executed from any text window:
ls (same as dir in DOS), cd (change directory), open, target,
find, line. Open opens the named file and makes it the front window.
File is similar except the window is made the target window (second
from front). “line n” selects selects the nth line of the target
window (n is a number. “Find exp” searchs the target window for the
string “exp.” Wildcards can be used with the find and ls commands,
just as you would expect in DOS.
In summary, hitting the enter key causes the current line or current
selection, whichever is smaller, to be interpreted as a command line.
Commands implemented:
cd Change default directory (folder). Note, the Mac
file system uses the colon to designate the present
or higher folders. Thus “cd ::” changes the default
directory one level up.
chcre Change a file’s creator. For example,
chcre 'MRPH' 'Current File' makes PlainText the
creator of the file named ‘Current File.’
chtyp Change the file type of a file, using the same
syntax (chtyp type filename) as chcre.
file Open a file and make it the target
find ss Find a string in the target window
ls List a directory’s contents
ls -l Give a full listing of a directory’s contents
line nn Select line nn in the target window
open ff Open a file
stats Prints the statistics of the target window
Target Window
Note that the “line” and “find” comands operate on the TARGET window. The
target window is the window behind the front-most window.
Large Files
PlainText must load its text files entirely into memory. If you get an
out-of-memory error message when trying to open a very large file, just
increase the partition (in the Finder’s Get-Info box for PlainText) to be
larger than the file being opened. In System 7, turn on virtual memory if
necessary.
Bug Reports
Send comments and complaints to:
Mel Park
Associate Professor
Department of Anatomy and Neurobiology
University of Tennessee
855 Monroe Avenue
Memphis, TN 38163
(901) 448-5984
mpark@utmem1.utmem.edu
PlainText is free.
Revision History
0.4: Fixed Standard File System 6 incompatibilities.
0.5: Wordwrap is now the default.
Horizontal scroll bar occurs when it should.
Wordwrap to window correctly updates window.
Fixed Out of Memory problem with add linefeeds.
0.6: Worksheet is an option.
Added font scaling and changing.
Open, file, and line commands now work in System 6.
All text moved to resources so that PlainText can now be
internationalized.
0.7: Added Align, Shift Left, and Shift Right functions.
Fixed bug in which a strings just past the cursor were not
found in a forward search.
Open with option key down shows all files, not just text
files.
0.8: SaveAFile stores resources properly and no longer causes
crashes.
The Standard File dialog is no longer displayed twice for new
files.
Typing no longer overwrites the horizontal scroll bar.
Fixed some minor annoyances in v. 0.8a, like new windows coming
up with the wrong horizonal scroll bar and the cursor not being
erased when a window is deselected.
0.9: There were bad crashes after some combinations of “Returns to
Linefeeds” and Saves or Closes, due to an old bug in the Mac
Menu Manager. Fixed now.
Similar bug was causing the Edit Menu to disappear when “No
Worksheet” was selected.
Worksheet and non-worksheet windows open with or without a
Go-Away Box as they should.
Added partial support for extended keyboard (Undo, cut, paste,
copy, page up, page down).
In System 7, opening from the finder directs Standard File package
to proper directory.
Horizonal arrow keys work properly except anchor point not yet
implemented.
0.91: Extended keyboard fully implemented.
Fixed crashes due to Menu Manager bug.
1.0: Added entab and detab functions.
Added word wrap to line lengths
Added autoindent
These last required additions to Format dialog.
Horizontal arrow keys now have an anchor point.
Word wrap to window is default for foreign text files as well
as new ones.
Command-arrow key functions now update the scroll bars.
Fixed conditions that would could cause a window to forget
that it was dirty, with subsequent loss of most-recently
typed data.
Text inserted at end of a line now drawn properly.
Errors in calculating buffer length in this last condition
also fixed.
Blinking cursor no longer interferes with text.
Show Invisibles with proportional fonts now works properly.
Go-Away box appears when it should in all conditions.
Fixed System 6 bugs--can now open from finder.
Hiliting of selection range is now always in the right place.
Inserting text beginning with a carriage return used to foul up
the line starts array. This could cause a crash.
Crashes related to marks and selections beyond the text buffer
fixed.
1.1: Fixed crashes due to errors in writing resources.
This means that resource forks are no longer corrupted.
Word wrap to length now works for newly opened documents.
Marks stopped working in v.1.0. Fixed.
Text now updated after Tile or Stack Windows.
Scroll bars now properly hilited after Tile and Stack Windows.
1.2: Format and date in ls -l command now correct.
Searches for Entire Word now work.
All Clipboard window deficiencies fixed, i.e. it is now updated
as it should be after cuts and copies, Menus are properly
updated when this is the selected window, and the blinking
cursor is disabled.
In large files, the blinking cursor would be displayed as a long
vertical line when the window was scrolled more than 32K pixels
beyond the insertion point. Fixed.
Line length default really set to 75. This means that the “Word
Wrap to Length” menu item works from the very beginning.
Implemented “Revert to Saved.”
Fixed scrolling error when large blocks of text deleted.
1.2a: When word wrap is on, Autoindent indents paragraphs, not lines.
PlainText will now open documents on locked volumes.
Saving now always flushes files to disk with every Save, even if
it is a sleeping PowerBook disk.
Tile and Stack Windows now work properly when there is no
worksheet.
No longer asks to save a saved new document when quitting.
Short lines nolonger pirate* the up and down arrow key cursor
movements.
Shift and align improved to work on word-wrapped paragraphs.
1.2b: Marks now aligned after pasting text.
Will now print beyond 32K of text.
1.2c: Marks now updated after large selections of text deleted.
Will now print invisible characters and tabs.
1.2d: Added page numbers to printed page.
1.2.1: First non-beta release to public servers, i.e. Info-Mac.
Restored “File open in another application” alert.
In word wrap, adding or deleting text that caused rewrapping of
paragraphs with more than 32 lines used to blank part of the
window above the changed text. Fixed.
1.2.2 “Tile Windows” formally tiled the Worksheet window and not the
last text window. It now excludes the Worksheet from tiling.
Added support for a Preferences file for storing defaults.
Added the stats command-line option.
Added a four-pixel tick mark at the top of each window to indicate
the printed page width, minus 1" right and left margins.
Tabs now aligned when typing in the middle of a line.
1.2.3 1.2.2 introduced a bug that caused characters typed at the beginning
of an empty window to either not be draw are drawn in the wrong
position.
1.2.4 There was still misalignment when tabs were typed. Fixed.
Added chtyp and chcre commands.
The “Find Selection” menu item now activated for locked windows.
Added the “Strip Controls” menu item.
1.2.5 Fixed curor misplacement when typing returns at the end of a text
file with AutoIndent on.
Files without resource forks would not open. I think this bug also
caused drag-and-drop to fail for these files.
Fixed the sometimes garbled text in the confirmation dialogs.
Cut and paste now works in the Find and Replace dialogs.
“Revert to Saved” previously caused a scrolling error.
1.2.6 Deleting an entire file would not delete the file’s marks. Fixed.
Cursor initialized with each activate event.
1.2.7 “Save As…” and “Save A Copy…” will now replace an existing file in
the proper way.
Added “P” as the keyboard equivalent for printing.
1.2.8 Zooming is now to the best size for a text window and not full screen.
All other Apple guidelines for zooming now conformed to.
Scroll bars no longer drawn twice in zooming.
Stats command now works at all times.
New window opened to ideal size.
1.2.9 Fixed zooming bug introduced in 1.2.8 that caused crashes in System 6.
Several obscure coding errors turned up in using the MetroWorks. These
were probably never seen by users.
1.2.9 Further fix of zooming bug. (Thanks to Bruce Craven and Joel Martin.)
Known bugs
Marks are not properly updated after entab and detab functions.
Marks sometimes not updated properly during normal editing. (Probably
fixed in v.1.2b.)
Unbroken text (i.e. containing no spaces) is wrapped to window width.
If no printer is selected, new windows do not appear on the screen.
Features to be added:
Modeless Search Dialog (thanks to David Wright).
Searching for carriage returns and other special characters.
Compile in PowerPC native mode.
Floating window for display of text stats.
Thanks to Bruce Craven, Doug Dyment, Scott Gruby, Ralph Muha, Florin Neumann,
Robert J. Rockefeller, Michael O’Henly, Russel N. Owen, Ted Ripberger, Rich
Siegel, David Wright, and particularly to Rich Scarlet for their many helpful
comments.
------------
* Geo-speak. A stream is pirated when its flow is diverted into a
neighboring water course.